package com.net.xpay.common.dao.stat;

import com.net.xpay.common.domain.stat.UserDailyStat;
import com.net.xpay.common.model.AggMonthUserDailyStatModel;
import com.net.xpay.common.model.AggOperatorUserDailyStatModel;
import com.net.xpay.common.model.AggUserDailyStatModel;
import com.net.xpay.common.model.search.OperatorUsersSearchModel;
import com.net.common.annotation.DataCommon;
import com.net.common.dao.Page;
import com.net.common.dao.PagedMapper;
import com.net.xpay.core.dto.SafePayBookAccountCountDto;
import com.net.xpay.core.model.UserDailyStatSearchModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@DataCommon
@Repository
public interface UserDailyStatMapper extends PagedMapper<Long, UserDailyStat> {
    List<AggUserDailyStatModel> aggSearch(@Param("searchModel") UserDailyStatSearchModel searchModel, @Param("page") Page page);

    long aggSearchCount(@Param("searchModel")UserDailyStatSearchModel searchModel);

    List<AggUserDailyStatModel> daySearch(@Param("yesterday") LocalDate yesterday,@Param("dayBefore") LocalDate dayBefore);

    List<AggMonthUserDailyStatModel> listByData(@Param("year")Integer year, @Param("month") Integer month);

    AggMonthUserDailyStatModel sumByUserIdAndData( @Param("userId")Long userId,@Param("year") Integer year, @Param("month") Integer month);

    AggOperatorUserDailyStatModel sumByUserIdAndSearchModel(@Param("userId")Long userId, @Param("searchModel") OperatorUsersSearchModel searchModel);

    List<UserDailyStat> listByDay(@Param("day") LocalDate day);

    SafePayBookAccountCountDto sumMonthAmount(@Param("monthTime") LocalDateTime startMonthTime, @Param("dayTime") LocalDateTime dayTime,@Param("userId") Long userId);
}
